// import { IUserSettingService } from '../inerface/user-setting.interface';
// import { UserSetting } from '../model/user-setting.model';
// import { StorageService } from 'wit-core';
// import { Predicate } from '@angular/core';

// export class UserSettingService implements IUserSettingService {
//     private static USER_SETTING_KEY = 'USER_SETTING_KEY';

//     constructor() {

//     }

//     save(setting: UserSetting) {
//         let settings = this.restoreSettingsFromLocalStorage();

//         StorageService.setLocalStorage({
//             key: UserSettingService.USER_SETTING_KEY,
//             value: settings.concat(setting)
//         });
//     }

//     restore(predicate: Predicate<UserSetting>): UserSetting[] {
//         let localSettings = this.restoreSettingsFromLocalStorage(predicate);
//         if (localSettings)
//             return localSettings;

//         // TODO query userSettings from server
//         return [];
//     }

//     private restoreSettingsFromLocalStorage(predicate: Predicate<UserSetting> = (us) => true): UserSetting[] {
//         let localSettings = <UserSetting[]>StorageService.getLocalStorageByKey(UserSettingService.USER_SETTING_KEY);
//         return localSettings ? localSettings.filter(predicate) : [];
//     }
// }
